package com.chanceit.ssss.activity;

import org.gl.GlobalVariable;
import org.gl.utils.AndroidUtil;

import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager;

import com.chanceit.ssss.data.DataSources;
import com.google.analytics.tracking.android.EasyTracker;

public class BaseFragmentActivity extends FragmentActivity implements
		OnClickListener {
	public static String TAG;
	DataSources ds;

	@Override
	protected void onCreate(Bundle arg0) {
		super.onCreate(arg0);
		ds = new DataSources();
	}

	@Override
	protected void onStart() {
		super.onStart();
		GlobalVariable.getInstance().addActivity(this);
		TAG = this.getClass().getSimpleName();
		EasyTracker.getInstance().activityStart(this); // Add this method.
		int inputMode = WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE;
		inputMode = inputMode
				| WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN;
		getWindow().setSoftInputMode(inputMode);
	}

	@Override
	protected void onStop() {
		// TODO Auto-generated method stub
		super.onStop();
		EasyTracker.getInstance().activityStop(this);
	}

	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub

	}

	@Override
	protected void onResume() {
		super.onResume();
		AndroidUtil.checkNetInActivity(this);
	}

	public void hideSoftInput(View view) {
		((InputMethodManager) getSystemService(INPUT_METHOD_SERVICE))
				.hideSoftInputFromWindow(view.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
	}
	public void showSoftInput(View view){
		((InputMethodManager)getSystemService(INPUT_METHOD_SERVICE)).showSoftInput(view, 0); 
	}
}
